﻿@model BBICMS.Model.Team

@{
    ViewBag.Title = "添加成员";
    ViewBag.PageTitle = ViewBag.Title + "_内容";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";

    var options = new AjaxOptions()
    {
        Url = Url.Action("Add", "Team"),
        LoadingElementId = "saving",
        LoadingElementDuration = 2000,
        //   Confirm = "Are you sure you want to save this User?"
        OnSuccess = "updateSuccess"

    };
}
@section Header{
  
}



@using (Ajax.BeginForm("Add", null, options, new { @class = "form-horizontal", role = "form" }))
            {

    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <div class="panel panel-default">
        <header class="panel-heading">
            <i class="glyphicon glyphicon-edit"></i> @ViewBag.Title
        </header>

        <section class="panel-body">



                <div class="form-group">
                    @Html.LabelFor(model => model.Nickname, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.Nickname, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Nickname, ViewData).Watermark })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Nickname)
                    </div>
                </div>

    <div class="form-group">
        @Html.LabelFor(model => model.RealName, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            @Html.TextBoxFor(model => model.RealName, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.RealName, ViewData).Watermark })
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.RealName)
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Mobile, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            @Html.TextBoxFor(model => model.Mobile, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Mobile, ViewData).Watermark })
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.Mobile)
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Address, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            @Html.TextBoxFor(model => model.Address, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Address, ViewData).Watermark })
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.Address)
        </div>
    </div>


    <div class="form-group">
        @Html.LabelFor(model => model.Skills, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            @Html.TextBoxFor(model => model.Skills, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Skills, ViewData).Watermark })
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.Skills)
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Post, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            @Html.TextBoxFor(model => model.Post, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Post, ViewData).Watermark })
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.Post)
        </div>
    </div>

    <div class="form-group">
        @Html.LabelFor(model => model.Email, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            @Html.TextBoxFor(model => model.Email, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Email, ViewData).Watermark })
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.Email)
        </div>
    </div>


    <div class="form-group">
        @Html.LabelFor(model => model.PhotoUrl, new { @class = "col-md-2 control-label" })
        <div class="col-md-5">
            <div class="input-group">
                @Html.TextBoxFor(model => model.PhotoUrl, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.PhotoUrl, ViewData).Watermark })
                <span class="input-group-btn">
                    <button class="btn btn-default" id="btnThumbnail" type="button">浏览…</button>
                </span>
            </div><!-- /input-group -->
        </div>
        <div class="col-md-5">
            @Html.ValidationMessageFor(model => model.PhotoUrl)
        </div>
    </div>
                
                
                <div class="form-group">
                    @Html.LabelFor(model => model.Description, new { @class = "col-md-2 control-label" })
                    <div class="col-md-10">
                        @Html.TextAreaFor(model => model.Description, new { @class = "form-control", placeholder = ModelMetadata.FromLambdaExpression(x => x.Description, ViewData).Watermark })
                        @Html.ValidationMessageFor(model => model.Description)
                    </div>
                 
                </div>


               
                <div class="form-group">
                    @Html.LabelFor(model => model.Importance, new { @class = "col-md-2 control-label" })
                    <div class="col-md-5">
                        @Html.TextBoxFor(model => model.Importance, new { @class = "form-control", type = "number", placeholder = "排序" })
                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Importance)
                    </div>

                </div>

              


                <div class="form-group">

                    <div class="col-md-5 col-md-offset-2">
                        <div class="checkbox">
                            <label>
                                @Html.CheckBoxFor(model => model.Active)  @Html.DisplayNameFor(model => model.Active)
                            </label>
                        </div>

                    </div>
                    <div class="col-md-5">
                        @Html.ValidationMessageFor(model => model.Active)
                    </div>

                </div>

 
         

        </section>
        <footer class="panel-footer text-center">
            <input type="submit" class="btn btn-primary" value="添加成员" /> <a href="@Url.Action("Index","Team")" class="btn btn-default"><span class="glyphicon glyphicon-arrow-left"></span> 返回</a>
        </footer>

    </div>
}


@section Footer {
    @Scripts.Render("~/bundles/jqueryval")

<script src="~/plugins/ckeditor/ckeditor.js"></script>
<script src="~/plugins/ckfinder/ckfinder.js"></script>
    <script>
        var editor = CKEDITOR.replace("Description", {
            allowedContent: true,
            filebrowserImageBrowseUrl: '/plugins/ckfinder/ckfinder.html?type=Images',
            filebrowserUploadUrl: '/plugins/ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
            filebrowserImageUploadUrl: '@Url.Content("~/Content/Uploads")'
        }
            );
        CKFinder.setupCKEditor(editor, '@Url.Content("~/plugins/ckfinder/")');

    function SetThumbnail(fileUrl) {
        $('#PhotoUrl').val(fileUrl);
    }


    function updateSuccess(data) {

       var title = '@ViewBag.Title';
        Common.ShowBox(data.Status, data.Message, title);


    }



    $(function () {
        $("#btnThumbnail").on("click", function () {
            var finder = new CKFinder();
            //  finder.basePath = '/plugins/ckfinder/';
            finder.selectActionFunction = SetThumbnail;
            finder.popup();
        });

        //当前菜单
        $('.mainmenu>li:nth-of-type(5)').addClass('nav-open').find('.submenu li:first a').addClass('active');
    });
    </script>
}






